<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // function hello() {
        //     console.log("hello");
        // }
        // //如果不调用函数，则没有执行打印语句
        // hello();

        // function sum(a, b) {
        //     return a + b;
        // }
        
        // console.log(sum(10));

        var add = function() {
            var sum = 0;
            for(var i = 0; i < arguments.length; i++) {
                sum += arguments[i];
            }
            return sum;
        }

        console.log(add(10, 20));//30
        console.log(add(1,2,3,4));//10
        console.log(typeof add);//function，表示是函数

        //console.log(function(1,2));
    </script>
</body>
</html>